package com.zhiyou.service.RecordeService.RecordeServiceImpl;

import com.zhiyou.bean.House;
import com.zhiyou.bean.Logistics;
import com.zhiyou.bean.Record;
import com.zhiyou.bean.RecordExample;
import com.zhiyou.dao.RecordMapper;
import com.zhiyou.service.RecordeService.RecordeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class RcordeServiceImpl implements RecordeService {

    @Autowired
    RecordMapper recordMapper;

    @Override
    public List<Record> getAll() {
        System.out.println("asdfasdfasdf");
        List<Record> list = recordMapper.selectAll();
        System.out.println("查询记录"+list);
        return list;
    }

    @Override
    public List<House> selectAddress() {

        System.out.println("===house表=====");

        List<House> list = recordMapper.selectAddress();

        for (House house : list) {
            System.out.println(house);
        }

        return list;
    }

    @Override
    public List<Logistics> selectName() {
        List<Logistics> logistics = recordMapper.selectName();

        return logistics;
    }

    @Override
    public int insert(Record r) {
        int i = recordMapper.insert(r);
        return i;
    }

    @Override
    public int updateOne(Record r) {
        int up = recordMapper.updateOne(r);
        return up;
    }

    @Override
    public Record detail(int id) {
        Record record = recordMapper.detail(id);
        return record;
    }

    @Override
    public int delete(int id) {
        int delete = recordMapper.delete(id);
        return delete;
    }



    @Override
    public List<Record> selectLike(Map<String,String> map) {
        System.out.println("===模糊查询==");
        List<Record> list = recordMapper.selectLike(map);
        System.out.println(list);
        return list;
    }

}
